package exercise1;

public class TextBuilder implements Builder {

    private StringBuilder stringBuilder;

    public TextBuilder(StringBuilder stringBuilder) {
        this.stringBuilder = stringBuilder;
    }

    public void makeTitle(String title) {
        stringBuilder.append("==========================\n");
        stringBuilder.append("[ " + title + " ]\n");
        stringBuilder.append("\n");
    }

    public void makeString(String string) {
        stringBuilder.append(string + "\n");
        stringBuilder.append("\n");
    }

    public void makeItems(String[] items) {
        for (int i = 0; i < items.length; i++){
            stringBuilder.append(" · " + items[i] + "\n");
        }
        stringBuilder.append("\n");
    }

    public void close() {
        stringBuilder.append("==========================");
    }

    public StringBuilder getStringBuilder() {
        return stringBuilder;
    }
}
